/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package reyes.mysite.jdo;

import java.util.Date;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 *
 * @author reyesyang
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Comment {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    @Persistent
    private String role;
    @Persistent
    private String poster;
    @Persistent
    private String email;
    @Persistent
    private String website;
    @Persistent
    private Text content;
    @Persistent
    private Date date;
    @Persistent
    private Blog blog;

    public Comment(
            String role,
            String poster,
            String email,
            String website,
            String content,
            Blog blog) {
        this.role = role;
        this.poster = poster;
        this.email = email;
        this.website = website;
        this.content = new Text(content);
        this.date = new Date();
        this.blog = blog;
    }

    public void setkey(Key key) {
        this.key = key;
    }
    
    public Key getKey() {
        return this.key;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getRole() {
        return this.role;
    }

    public void setPoster(String poster) {
        this.poster = poster;
    }

    public String getPoster() {
        return this.poster;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getEmail() {
        return this.email;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public String getWebsite() {
        return this.website;
    }

    public void setContent(String content) {
        this.content = new Text(content);
    }

    public String getContent() {
        return this.content.getValue();
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getDate() {
        return this.date;
    }

    public void setBlog(Blog blog) {
        this.blog = blog;
    }

    public Blog getBlog() {
        return this.blog;
    }
}
